package p270jp.pxv.android.upload;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.widget.RelativeLayout;
import com.edmodo.cropper.CropImageView;
import p014ae.View$OnClickListenerC0046a;
import p014ae.View$OnClickListenerC0054c;
import p325m0.MutabilityOwnership;
import p436q6.StringMerger;
import p602wl.EditImageListener;

/* compiled from: EditImageView.kt */
/* renamed from: jp.pxv.android.upload.EditImageView */
/* loaded from: classes2.dex */
public final class EditImageView extends RelativeLayout {

    /* renamed from: h */
    public static final /* synthetic */ int f19347h = 0;

    /* renamed from: a */
    public final AlphaAnimation f19348a;

    /* renamed from: b */
    public final AlphaAnimation f19349b;

    /* renamed from: c */
    public EditImageListener f19350c;

    /* renamed from: d */
    public CropImageView f19351d;

    /* renamed from: e */
    public final int f19352e;

    /* renamed from: f */
    public final int f19353f;

    /* renamed from: g */
    public final int f19354g;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public EditImageView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        MutabilityOwnership.m3745m(context, "context");
        MutabilityOwnership.m3745m(attributeSet, "attrs");
        AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
        this.f19348a = alphaAnimation;
        AlphaAnimation alphaAnimation2 = new AlphaAnimation(0.0f, 1.0f);
        this.f19349b = alphaAnimation2;
        alphaAnimation.setDuration(300);
        alphaAnimation2.setDuration(300);
        boolean z = false;
        TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, StringMerger.f25257a, 0, 0);
        MutabilityOwnership.m3746l(obtainStyledAttributes, "context.theme.obtainStyl…able.EditImageView, 0, 0)");
        int resourceId = obtainStyledAttributes.getResourceId(0, 0);
        this.f19352e = resourceId;
        if (resourceId != 0) {
            int resourceId2 = obtainStyledAttributes.getResourceId(1, 0);
            this.f19353f = resourceId2;
            if (resourceId2 != 0) {
                int resourceId3 = obtainStyledAttributes.getResourceId(2, 0);
                this.f19354g = resourceId3;
                if (!(resourceId3 != 0 ? true : z)) {
                    throw new IllegalArgumentException("EditImageViewにapp:saveViewが設定されていません".toString());
                }
                return;
            }
            throw new IllegalArgumentException("EditImageViewにapp:rotationViewが設定されていません".toString());
        }
        throw new IllegalArgumentException("EditImageViewにapp:cropImageViewが設定されていません".toString());
    }

    @Override // android.view.View
    public void onFinishInflate() {
        super.onFinishInflate();
        View findViewById = findViewById(this.f19352e);
        MutabilityOwnership.m3746l(findViewById, "findViewById(cropImageViewId)");
        CropImageView cropImageView = (CropImageView) findViewById;
        this.f19351d = cropImageView;
        cropImageView.f5898i = 10;
        cropImageView.f5891b.setAspectRatioX(10);
        cropImageView.f5899j = 10;
        cropImageView.f5891b.setAspectRatioY(10);
        findViewById(this.f19353f).setOnClickListener(new View$OnClickListenerC0046a(this, 19));
        findViewById(this.f19354g).setOnClickListener(new View$OnClickListenerC0054c(this, 23));
    }

    public final void setEditImageListener(EditImageListener aVar) {
        MutabilityOwnership.m3745m(aVar, "editImageListener");
        this.f19350c = aVar;
    }

    public final void setImage(Bitmap bitmap) {
        MutabilityOwnership.m3745m(bitmap, "bitmap");
        CropImageView cropImageView = this.f19351d;
        if (cropImageView != null) {
            cropImageView.setImageBitmap(bitmap);
        } else {
            MutabilityOwnership.m3737u("cropImageView");
            throw null;
        }
    }
}
